{extend name="public/base" /}

{block name="title"}修改配置{/block}

{block name="main"}
<div class="layui-tab" id="Js_title_navigation">
    <ul class="layui-tab-title">
        <li class="layui-this">添加配置</li>
    </ul>
</div>
<form class="layui-form layui-row " action="" method="post">
    <input type="hidden" name="id" value="{$id}" />
	<div class="layui-col-xs12" style="padding-bottom: 50px;">
		<div class="layui-form-item layui-col-md4">
			<label class="layui-form-label">配置名称：</label>
			<div class="layui-input-block">
				<input type="text" name="name" lay-verify="required" value="{$info['name']}" placeholder="请输入配置名称" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item layui-col-md4">
			<label class="layui-form-label">配置标识：</label>
			<div class="layui-input-block">
				<input type="text" name="tag" value="{$info['tag']}" placeholder="请填写配置的唯一标识" lay-verify="required" class="layui-input pwd">
			</div>
		</div>
		<div class="layui-form-item ">
			<label class="layui-form-label">配置类型 ：</label>
			<div class="layui-input-block">
                <input {$info['type']==1?'checked':''} type="radio" name="type" value="1" title="公共配置" />
                <input {$info['type']==2?'checked':''} type="radio" name="type" value="2" title="平台专属配置" />
                <input {$info['type']==3?'checked':''} type="radio" name="type" value="3" title="站点专属配置"  />
			</div>
		</div>
		<div class="layui-form-item layui-col-md6">
			<label class="layui-form-label">配置说明：</label>
			<div class="layui-input-block">
              <textarea name="note" placeholder="配置说明" class="layui-textarea">{$info['note']}</textarea>
            </div>
		</div>
		<div class="layui-form-item layui-col-md4">
			<label class="layui-form-label">配置格式：</label>
			<div class="layui-input-block">
                <input {$info['show']==1?'checked':''} type="radio" name="show" value="1" title="文本" checked />
                <input {$info['show']==2?'checked':''} type="radio" name="show" value="2" title="二维数组" />
                <input {!is_numeric($info['show'])?'checked':''} type="radio" name="show" value="2" title="其他模板" />
			</div>
		</div>  
        <div class="layui-form-item layui-col-md10">
			<label class="layui-form-label">配置内容：</label>
			<div class="layui-input-block">
                <textarea name="content" placeholder="配置内容" class="layui-textarea">{$info['content']}</textarea>
			</div>
		</div>        
	</div>
    <div class="layui-layout-admin" >
        <div class="layui-footer" style="left:0;">
            <div class="layui-form-item">
                <a href="javascript:;" class="layui-btn layui-btn-primary" onclick="javascript:history.back();">返回</a>
				<button type="button" class="layui-btn" lay-submit="" lay-filter="addFrom">立即修改</button>
			</div>
        </div>
    </div>

</form>
{/block}
{block name="script"}
<script>
layui.use(['form','common'],function(){
    var form = layui.form;
    
    form.on('submit(addFrom)',function(data){
        layui.common.post("/sys/config/edit",data.field);
        return false;
    });
    
    form.render(); //更新全部
})
</script>
{/block}